<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">
<head th:replace="incloude/common::common_header(~{::meta},~{::link})"></head>
<head>
    <title>地区编辑</title>
</head>

<body>

<div>
    <div class="layui-fluid">
        <div class="layui-row layui-col-space15">
            <div class="layui-col-md12">
                <div class="layui-card">
                    <div class="layui-card-body">
                        <div class="layui-tab layui-tab-brief" lay-filter="component-tabs-brief">
                            <ul class="layui-tab-title">
                                <li>
                                    <a th:href="${adminPath} + '/area/list'" >地区列表</a>
                                </li>
                                <li class="layui-this">
                                    <a href="javascript:void(0);">地区编辑</a>
                                </li>
                            </ul>
                            <div class="layui-tab-content">
                                <div class="layui-tab-item layui-show">
                                    <blockquote class="layui-elem-quote" style="border-left: 5px solid #ff0000;">地区维护使用全手工方式，请谨慎操作！</blockquote>
                                    <form class="layui-form layui-form-pane" th:action="${adminPath} + '/area/save'">
                                        <div class="layui-form">
                                            <div class="layui-form-item">
                                                <div class="layui-inline">
                                                    <label class="layui-form-label"><em class="gg-star">* </em>id:</label>
                                                    <div class="layui-input-inline">
                                                        <input type="text" name="id" th:value="${area.id}" lay-verify="required" class="layui-input" autocomplete="off" />
                                                    </div>
                                                </div>
                                                <div class="layui-inline">
                                                    <label class="layui-form-label"><em class="gg-star">* </em>上级id:</label>
                                                    <div class="layui-input-inline">
                                                        <input type="text" name="pid" th:value="${area.pid}" lay-verify="required" class="layui-input" autocomplete="off" />
                                                    </div>
                                                </div>
                                                <div class="layui-inline">
                                                    <label class="layui-form-label"><em class="gg-star">* </em>地区等级:</label>
                                                    <div class="layui-input-inline">
                                                        <select name="levelType" lay-verify="required" th:value="${area.levelType}">
                                                            <option value="">请选择地区等级</option>
                                                            <option value="0" th:selected="${area.levelType == 0}">国家</option>
                                                            <option value="1" th:selected="${area.levelType == 1}">省</option>
                                                            <option value="2" th:selected="${area.levelType == 2}">地级市</option>
                                                            <option value="3" th:selected="${area.levelType == 3}">区/县</option>
                                                        </select>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="layui-form">
                                            <div class="layui-form-item">
                                                <div class="layui-inline">
                                                    <label class="layui-form-label"><em class="gg-star">* </em>地区名称:</label>
                                                    <div class="layui-input-inline">
                                                        <input type="text" name="name" th:value="${area.name}" lay-verify="required" class="layui-input" autocomplete="off" />
                                                    </div>
                                                </div>
                                                <div class="layui-inline">
                                                    <label class="layui-form-label">简称:</label>
                                                    <div class="layui-input-inline">
                                                        <input type="text" name="shortName" th:value="${area.shortName}" class="layui-input" autocomplete="off" />
                                                    </div>
                                                </div>
                                                <div class="layui-inline">
                                                    <label class="layui-form-label">拼音:</label>
                                                    <div class="layui-input-inline">
                                                        <input type="text" name="phoneticize" th:value="${area.phoneticize}" class="layui-input" autocomplete="off" />
                                                    </div>
                                                </div>
                                            </div>
                                        </div>

                                        <div class="layui-form">
                                            <div class="layui-form-item">
                                                <div class="layui-inline">
                                                    <label class="layui-form-label">经度:</label>
                                                    <div class="layui-input-inline">
                                                        <input type="text" name="lng" th:value="${area.lng}" class="layui-input" autocomplete="off" />
                                                    </div>
                                                </div>
                                                <div class="layui-inline">
                                                    <label class="layui-form-label">纬度:</label>
                                                    <div class="layui-input-inline">
                                                        <input type="text" name="lat" th:value="${area.lat}" class="layui-input" autocomplete="off" />
                                                    </div>
                                                </div>
                                            </div>
                                        </div>

                                        <div class="layui-form">
                                            <div class="layui-form-item">
                                                <div class="layui-inline">
                                                    <label class="layui-form-label">全称:</label>
                                                    <div class="layui-input-inline">
                                                        <input type="text" name="mergeName" th:value="${area.mergeName}" class="layui-input" autocomplete="off" />
                                                    </div>
                                                    <div class="layui-form-mid layui-word-aux">例如:中国,甘肃省,兰州市,兰州新区</div>
                                                </div>
                                            </div>
                                        </div>

                                        <div class="layui-form-item layui-layout-admin">
                                            <div class="layui-input-block">
                                                <div class="layui-footer" style="left: 0;">
                                                    <button class="layui-btn" lay-submit lay-filter="port-form-submit">立即提交</button>
                                                    <input type="button" class="layui-btn  layui-btn-primary" onclick="history.go(-1)" value="返回">
                                                </div>
                                            </div>
                                        </div>
                                    </form>

                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>


<div th:replace="incloude/common::common_js"></div>
<div th:replace="incloude/common::layui_config"></div>
<script th:inline="javascript">
    layui.use(['layer','form'], function(){
        const layer = layui.layer;
        const form = layui.form;

        //表单验证
        form.verify();

        //监听提交
        form.on('submit(port-form-submit)', function(data){
            layer.confirm('确认提交数据？', function(index){
                layer.close(index);
                $('.layui-form').submit();
            });
            return false;
        });

    });

</script>

</body>
</html>